export function isObject(value: unknown): value is Record<any, any> {
    return value !== null && typeof value === 'object';
}

const hasOwnProperty = Object.prototype.hasOwnProperty
/** 是否自身上存在属性 */
export function hasOwn(val: object, key: string | number | symbol): key is keyof typeof val {
    if (val instanceof cc.Component) {
        return key in val;
    }
    return hasOwnProperty.call(val, key);
}

/** 比较值是否变化了，考虑NaN；如果是对象直接认为改变了 */
export function hasChanged(value: any, oldValue: any): boolean {
    let type = typeof value;
    if (type === "object") return true;
    return !Object.is(value, oldValue);
}
